package common

// 自定义系统错误码与错误信息

const (
	SUCCESS             = 20000
	FAIL                = 40000
	Unauthorized        = 40001
	Forbidden           = 40003
	InternalServerError = 50000
	IllegalToken        = 50008
	TokenExpire         = 50014

	// 61xxx: User的错误

	// 62xxx: Membership的错误
	GetActiveCodeError           = 62000
	GenerateActiveCodeError      = 62001
	SetCodeInRedisError          = 62002
	CodeExpireOrInvalidError     = 62003
	CodeNotFoundMsgError         = 62004
	CodeMismatchError            = 62005
	RedeemMembershipError        = 62006
	MembershipAlreadyExistsError = 62007
)

const (
	SuccessMsg             = "操作成功"
	FailMsg                = "操作失败"
	UnauthorizedMsg        = "登录过期，请重新登陆"
	LoginCheckErrMsg       = "用户名或密码错误"
	ForbiddenMsg           = "无权访问该资源，请联系网站管理员授权"
	InternalServerErrorMsg = "服务器内部错误"
	IllegalTokenMsg        = "Token校验失败"
	TokenExpireMsg         = "Token已过期"

	GetActiveCodeMsg           = "获取兑换码失败"
	GenerateActiveCodeMsg      = "生成会员兑换码失败"
	SetCodeInRedisMsg          = "向Redis中存储会员兑换码失败"
	CodeExpireOrInvalidMsg     = "兑换码无效或已过期，请联系管理员"
	CodeNotFoundMsg            = "兑换码不存在"
	CodeMismatchMsg            = "兑换码不匹配"
	RedeemMembershipMsg        = "兑换会员资格失败"
	MembershipAlreadyExistsMsg = "已拥有有效会员资格，请失效后再续期"
)

var CustomError = map[int]string{
	SUCCESS:             SuccessMsg,
	FAIL:                FailMsg,
	Unauthorized:        UnauthorizedMsg,
	Forbidden:           ForbiddenMsg,
	InternalServerError: InternalServerErrorMsg,
	IllegalToken:        IllegalTokenMsg,
	TokenExpire:         TokenExpireMsg,

	GetActiveCodeError:           GetActiveCodeMsg,
	GenerateActiveCodeError:      GenerateActiveCodeMsg,
	SetCodeInRedisError:          SetCodeInRedisMsg,
	CodeExpireOrInvalidError:     CodeExpireOrInvalidMsg,
	CodeNotFoundMsgError:         CodeNotFoundMsg,
	CodeMismatchError:            CodeMismatchMsg,
	RedeemMembershipError:        RedeemMembershipMsg,
	MembershipAlreadyExistsError: MembershipAlreadyExistsMsg,
}
